using System;
using System.Collections;
using System.Xml;

namespace UNLV.IAP.WebControls
{
	/// <summary>
	/// Strongly typed collection of SqlWhereBuilderValue objects.
	/// </summary>
	[Serializable]
	public class SqlWhereBuilderValueEntryDivCollection : CollectionBase
	{

		public bool Contains(string id)
		{
			foreach(SqlWhereBuilderValueEntryDiv v in this)
			{
				if (v.Id == id)
					return true;
			}
			return false;
		}

		public SqlWhereBuilderValueEntryDiv this[ int index ]  
		{
			get  
			{
				return( (SqlWhereBuilderValueEntryDiv) List[index] );
			}
			set  
			{
				List[index] = value;
			}
		}

		public int Add( SqlWhereBuilderValueEntryDiv value )  
		{
			return( List.Add( value ) );
		}

		public int IndexOf( SqlWhereBuilderValueEntryDiv value )  
		{
			return( List.IndexOf( value ) );
		}

		public void Insert( int index, SqlWhereBuilderValueEntryDiv value )  
		{
			List.Insert( index, value );
		}

		public void Remove( SqlWhereBuilderValueEntryDiv value )  
		{
			List.Remove( value );
		}

		public bool Contains( SqlWhereBuilderValueEntryDiv value )  
		{
			// If value is not of type SqlWhereBuilderValueEntryDiv, this will return false.
			return( List.Contains( value ) );
		}

		protected override void OnInsert( int index, Object value )  
		{
			if ( value.GetType() != Type.GetType("UNLV.IAP.WebControls.SqlWhereBuilderValueEntryDiv") )
				throw new ArgumentException( "value must be of type SqlWhereBuilderValueEntryDiv.", "value" );
		}

		protected override void OnRemove( int index, Object value )  
		{
			if ( value.GetType() != Type.GetType("UNLV.IAP.WebControls.SqlWhereBuilderValueEntryDiv") )
				throw new ArgumentException( "value must be of type SqlWhereBuilderValueEntryDiv.", "value" );
		}

		protected override void OnSet( int index, Object oldValue, Object newValue )  
		{
			if ( newValue.GetType() != Type.GetType("UNLV.IAP.WebControls.SqlWhereBuilderValueEntryDiv") )
				throw new ArgumentException( "newValue must be of type SqlWhereBuilderValueEntryDiv.", "newValue" );
		}

		protected override void OnValidate( Object value )  
		{
			if ( value.GetType() != Type.GetType("UNLV.IAP.WebControls.SqlWhereBuilderValueEntryDiv") )
				throw new ArgumentException( "value must be of type SqlWhereBuilderValueEntryDiv." );
		}



	}
}
